#region Using directives

using System;
using System.Windows.Forms;
using System.Drawing;
using System.Diagnostics;
using System.Globalization;
using System.Drawing.Drawing2D;
using System.Collections.Generic;
#endregion

namespace WinformToolkit.Drawing
{
    using PointList = List<PointF>;
    using PointEnumerator = IEnumerator<PointF>;

    ///// <summary>
    ///// Polygon graphic object
    ///// </summary>
    //public class DrawPolygon : WinformToolkit.Drawing.DrawLine
    //{
    //    private PointList pointArray;         // list of points

    //    private static Cursor handleCursor = new Cursor(typeof(DrawPolygon), "PolyHandle.cur");

    //    private const string entryLength = "Length";
    //    private const string entryPoint = "Point";


    //    public override DrawArea.DrawToolType Type => DrawArea.DrawToolType.Polygon;

    //    public DrawPolygon() : base()
    //    {
    //        pointArray = new PointList();

    //        Initialize();
    //    }

    //    public DrawPolygon(int x1, int y1, int x2, int y2) : base()
    //    {
    //        pointArray = new PointList();
    //        pointArray.Add(new Point(x1, y1));
    //        pointArray.Add(new Point(x2, y2));

    //        Initialize();
    //    }

    //    /// <summary>
    //    /// Clone this instance
    //    /// </summary>
    //    public override DrawObject Clone()
    //    {
    //        DrawPolygon drawPolygon = new DrawPolygon();

    //        foreach(PointF p in this.pointArray)
    //        {
    //            drawPolygon.pointArray.Add(p);
    //        }

    //        FillDrawObjectFields(drawPolygon);
    //        return drawPolygon;
    //    }


    //    public override void Draw(DrawingContext dc)
    //    {
    //        Graphics g = dc.Graphics;

    //        float x1 = 0, y1 = 0;     // previous point
    //        float x2, y2;             // current point

    //        g.SmoothingMode = SmoothingMode.AntiAlias;

    //        Pen pen = new Pen(Color, PenWidth);

    //        PointEnumerator enumerator = pointArray.GetEnumerator();

    //        if (enumerator.MoveNext())
    //        {
    //            x1 = (enumerator.Current).X;
    //            y1 = (enumerator.Current).Y;
    //        }

    //        while (enumerator.MoveNext())
    //        {
    //            x2 = (enumerator.Current).X;
    //            y2 = (enumerator.Current).Y;

    //            g.DrawLine(pen, x1, y1, x2, y2);

    //            x1 = x2;
    //            y1 = y2;
    //        }

    //        pen.Dispose();
    //    }

    //    public void AddPoint(Point point)
    //    {
    //        pointArray.Add(point);
    //    }

    //    public override int HandleCount
    //    {
    //        get
    //        {
    //            return pointArray.Count;
    //        }
    //    }

    //    /// <summary>
    //    /// Get handle point by 1-based number
    //    /// </summary>
    //    /// <param name="handleNumber"></param>
    //    /// <returns></returns>
    //    public override PointF GetHandle(int handleNumber)
    //    {
    //        if (handleNumber < 1)
    //            handleNumber = 1;

    //        if (handleNumber > pointArray.Count)
    //            handleNumber = pointArray.Count;

    //        return (pointArray[handleNumber - 1]);
    //    }

    //    public override Cursor GetHandleCursor(int handleNumber)
    //    {
    //        return handleCursor;
    //    }

    //    public override void MoveHandleTo(PointF point, int handleNumber)
    //    {
    //        if (handleNumber < 1)
    //            handleNumber = 1;

    //        if (handleNumber > pointArray.Count)
    //            handleNumber = pointArray.Count;

    //        pointArray[handleNumber - 1] = point;

    //        Invalidate();
    //    }

    //    public override void Move(int deltaX, int deltaY)
    //    {
    //        int n = pointArray.Count;
    //        PointF point;

    //        for (int i = 0; i < n; i++)
    //        {
    //            point = new PointF((pointArray[i]).X + deltaX, (pointArray[i]).Y + deltaY);

    //            pointArray[i] = point;
    //        }

    //        Invalidate();
    //    }

    //    /// <summary>
    //    /// Create graphic object used for hit test
    //    /// </summary>
    //    protected override void CreateObjects()
    //    {
    //        if (AreaPath != null)
    //            return;

    //        // Create closed path which contains all polygon vertexes
    //        AreaPath = new GraphicsPath();

    //        float x1 = 0, y1 = 0;     // previous point
    //        float x2, y2;             // current point

    //        PointEnumerator enumerator = pointArray.GetEnumerator();

    //        if (enumerator.MoveNext())
    //        {
    //            x1 = (enumerator.Current).X;
    //            y1 = (enumerator.Current).Y;
    //        }

    //        while (enumerator.MoveNext())
    //        {
    //            x2 = (enumerator.Current).X;
    //            y2 = (enumerator.Current).Y;

    //            AreaPath.AddLine(x1, y1, x2, y2);

    //            x1 = x2;
    //            y1 = y2;
    //        }

    //        AreaPath.CloseFigure();

    //        // Create region from the path
    //        AreaRegion = new Region(AreaPath);
    //    }
    //}
}

